Domestic Load Research Programme Social Survey Exploration

This notebook requires access to a data directory with DLR survey data saved as feather objects. The data files must be saved in /data/tables/ .


In [2]:
import processing.procore as pcore
import features.socios as s

tbls = pcore.loadTables()
print("Stored Data Tables\n")
for k in sorted(list(tbls.keys())):
    print(k)


Stored Data Tables

answerid
answers
answers_blob_anon
answers_char_anon
answers_number_anon
groups
links
profileid
profiles
profilesummary
qconstraints
qdtype
qredundancy
questionaires
questions
recorderinstall

List of Questionaires


In [3]:
tbls['questionaires'][tbls['questionaires'].QuestionaireID.isin([3, 4, 6, 7, 1000000, 1000001, 1000002])]


Out[3]:
QuestionaireID Description ViewName lock
2 3 NLR Main form NLR 0
3 4 Interviewer information Interviewer 0
6 6 NRS Form 1994-1999 NLR99 0
7 7 Namibia Form Namibia 0
9 1000000 Clinic Questionaire ND_Clinic 0
10 1000001 Shop Questionaire ND_shop 0
11 1000002 School Questionaire ND_School 0

Search Questions


In [4]:
searchterm = ['earn per month', 'watersource', 'GeyserNumber', 'GeyserBroken', 'roof', 'wall', 'main switch', 'floor area']
questionaire_id = 3
s.searchQuestions(searchterm, questionaire_id)


Out[4]:
Question Datatype QuestionaireID ColumnNo Lower Upper
119 How much do all the adults earn per month befo... num 3 96 0.0 10.0
123 Construction of walls num 3 102 0.0 1.0
124 Construction of Roof num 3 103 0.0 10.0
125 Floor aread of main house num 3 104 0.0 1.0
129 Watersource num 3 108 0.0 50.0
136 ApplianceGeyserNumber num 3 115 0.0 1.0
151 ApplianceGeyserBroken num 3 131 0.0 1.0
191 What is the size of the main switch? num 3 217 0.0 10.0

Search Answers


In [5]:
searchterm = ['earn per month', 'watersource', 'GeyserNumber', 'GeyserBroken', 'roof', 'wall', 'main switch', 'floor area']
questionaire_id = 3
answers = s.searchAnswers(searchterm, questionaire_id)
print(answers[1])
answers[0].head()


     ColumnNo                                           Question
119        96  How much do all the adults earn per month befo...
123       102                              Construction of walls
124       103                               Construction of Roof
125       104                          Floor aread of main house
129       108                                        Watersource
136       115                              ApplianceGeyserNumber
151       131                              ApplianceGeyserBroken
191       217               What is the size of the main switch?
Out[5]:
AnswerID 96 102 103 104 108 115 131 217
3 34 16000.0 4.0 8.0 115.0 4.0 1.0 0.0 60.0
7 33 NaN 4.0 8.0 115.0 4.0 1.0 0.0 60.0
10 230 9000.0 4.0 8.0 150.0 4.0 1.0 0.0 60.0
11 43 15000.0 4.0 8.0 115.0 4.0 1.0 0.0 60.0
12 44 NaN 4.0 8.0 104.0 4.0 1.0 0.0 60.0

List of Site Locations and Corresponding RecorderIDs by Year


In [6]:
s.recorderLocations(year = 2011)


Out[6]:
GroupID loc recorder_abrv
261 1000104 Ga-Luka LUK
291 1000105 Ga-Nkoane GNK
321 1000106 Hankey HKY
348 1000107 Matshana MTS
378 1000108 Vlaklaagte VLK
408 1000109 Wattville WVL

In [ ]: